package com.qf.listener;

import com.event.EventListener;
import com.qf.entity.Room;
import com.qf.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RoomEventListener implements EventListener<Room> {
    @Autowired
    private ISearchService searchService;

    @Override
    public String eventType() {
        return "room_insert";
    }

    @Override
    public void eventHandler(Room room) {
        System.out.println("客房搜索服务" + room);
        searchService.insertRoom(room);
        searchService.insertRoomPrice(room.getHid(), room.getPrices());

    }
}
